home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17028 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.0 KB  |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: netcom.com!guzz
  3. From: guzz@netcom.com (Adam Gensler)
  4. Subject: Re: HELP Borland C++ 5.0 pointer problem
  5. Message-ID: <316e9fdb.457757@10.0.2.1>
  6. Sender: guzz@netcom16.netcom.com
  7. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  8. X-Newsreader: Forte Agent .99d/32.182
  9. References: <4klke8$7mb@dub-news-svc-2.compuserve.com>
  10. Date: Fri, 12 Apr 1996 18:31:06 GMT
  11.  
  12.     I'm not quite sure what you're trying to do, but it looks like you're
  13. trying to set your char * to the new buffer.  That won't work because when you
  14. leave the function the memeory reserved for buffer[20] is marked as free.  I
  15. think that's right.
  16.  
  17. On Fri, 12 Apr 1996 21:04:49 GMT, 100660.2242@compuserve.com (Andy Graham)
  18. wrote:
  19.  
  20. >Could you please tell me why the function below compiles and operates
  21. >correctly under win16 but not win32 ?
  22. >
  23. >  char* test_function(char *in_data) {
  24. >
  25. >    char buffer[20];
  26. >    strcpy(buffer, in_data);   // copy in_data to buffer
  27. >    in_data = buffer;   // set pointer to buffer
  28. >
  29. >    return(in_data);
  30. >
  31. >  }  // end test_function function
  32.